<?php $this->pageTitle = Yii::app()->user->name; ?>
<div class="c_body">
	<div class="cat_head">
		<div class="cat_head_strip"></div>
		<a href="<?php echo Yii::app()->createUrl('albums/indexGroup', array('group'=>Yii::app()->request->getParam('group'))); ?>" class="cat_head_btn_r r_m">
			<div class="cat_head_btn_l">Альбомы</div>
		</a>
		<div class="cat_head_h"><p class="cat_head_h_txt"><span><?php echo $photos; ?></span> фотографии в <span><?php echo $albums; ?></span> альбомах </p></div>
	</div>
	<?php if($checkOwner):?>
		<form name="form" action="<?php echo Yii::app()->createUrl('albums/uploadPhotoGroup', array('id'=>$model->id,'group'=>Yii::app()->request->getParam('group')))?>" method="POST" enctype="multipart/form-data">
		<img id="loading" src="/images/loading.gif" style="display:none;">
		<div class="add_files_fld">
			<div class="c">
				<div class="cc">
					<div class="add_files_fld_txt">перетащите сюда фото для загрузки</div>
					<a href="#" class="green_btn"><i>+</i>Добавить фото</a>
					<label for="fileToUpload"><i>+</i>Добавить фото</label>
					<input id="fileToUpload" type="file" size="45" name="image" class="fileUpload"/>
				</div>
			</div>
		</div>
		</form>
	<?php endif; ?>
	<div class="cat_list_block">
		<h1><?php echo $model->name; ?></h1>
		<div class="cat_list">
			<?php foreach ($model->photos as $key => $value) : ?>
				<div class="u_media cat_list_item photoViewItem" >
					<?php echo $this->material_image($value->id, $value->name, '200', 'groups/'.$value->album->group->id.'/'.$value->album->id); ?>
					<div class="mask hover hidden"></div>
					<div class="links hidden">
						<a href="<?php echo Yii::app()->createUrl('albums/photoGroup', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group'))); ?>" class="u_link photoView"><span class="u_link_icon i4"></span><em>Просмотр</em></a>
						<?php if($value->album->main_photo_id != $value->id):?>
							<a href="<?php echo Yii::app()->createUrl('albums/mainphoto', array('id'=>$value->id, 'group'=>Yii::app()->request->getParam('group'))); ?>" class="u_link removeLink"><span class="u_link_icon i5"></span><em>Сделать главной</em></a>
						<?php endif;?>
						<?php 
							echo CHtml::link('<span class="u_link_icon i6"></span><em>Удалить</em>', array('albums/deletePhoto', 'id'=>$value->id, 'group'=>Yii::app()->request->getParam('group')),
							  array(
							    'submit'=>array('albums/deletePhoto', 'id'=>$value->id, 'group'=>Yii::app()->request->getParam('group')),
							    'class' => 'u_link removeLink',
						  		'confirm'=>'Вы уверены что хотите удалить фото?'
							  )
							);
						?>
					</div>
				</div>
			<?php endforeach; ?>
		</div>
	</div>
	<div class="clear"></div>
</div>